﻿<ResourceDictionary 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:TabbedWPFSample"
    xmlns:awe="http://schemas.awesomium.com/winfx">

    <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />

    <DrawingImage x:Key="HomeImage">
        <DrawingImage.Drawing>
            <DrawingGroup>
                <DrawingGroup.Children>
                    <GeometryDrawing Brush="Black" Geometry="F1 M 9.46933,0.573334L 0.480001,10.0653C 0.160001,10.4013 6.05981e-007,10.792 6.05981e-007,11.2933L 6.05981e-007,11.2933C 6.05981e-007,11.7413 0.160001,12.1907 0.480001,12.5253L 0.480001,12.5253C 0.798667,12.8587 1.224,13.0267 1.70267,13.0267L 1.70267,13.0267C 2.12933,13.0267 2.55467,12.8587 2.87467,12.5253L 10.64,4.31467L 18.46,12.5253C 18.7773,12.8587 19.1507,13.0267 19.6827,13.0267L 19.6827,13.0267C 20.108,13.0267 20.4813,12.8587 20.8547,12.5253L 20.8547,12.5253C 21.1173,12.2507 21.236,11.9 21.2987,11.536L 21.2987,11.032C 21.236,10.6533 21.1173,10.34 20.8547,10.0653L 11.864,0.573334C 11.4907,0.238668 11.1187,0.069334 10.64,0.069334L 10.64,0.069334C 10.2147,0.069334 9.788,0.238668 9.46933,0.573334 Z M 10.2147,6.268L 3.192,13.6947L 3.192,19.392C 3.192,20.4813 3.61467,21.1293 4.45733,21.3333L 8.3,21.3333L 8.3,13.528C 8.3,13.4187 8.352,13.2507 8.45867,13.192L 8.45867,13.192C 8.512,13.0813 8.67067,13.0267 8.77867,13.0267L 12.4493,13.0267C 12.6093,13.0267 12.7147,13.0813 12.768,13.192L 12.768,13.192C 12.8747,13.2507 12.9267,13.4187 12.9267,13.528L 12.9267,21.3333L 16.7693,21.3333C 17.6133,21.1293 18.036,20.4813 18.036,19.392L 18.036,13.584L 11.0653,6.324C 10.9053,6.1 10.8,5.98934 10.64,5.98934L 10.64,5.98934C 10.5347,5.98934 10.3747,6.1 10.2147,6.268 Z " />
                </DrawingGroup.Children>
            </DrawingGroup>
        </DrawingImage.Drawing>
    </DrawingImage>

    <DrawingImage x:Key="ReloadImage">
        <DrawingImage.Drawing>
            <DrawingGroup>
                <DrawingGroup.Children>
                    <GeometryDrawing Brush="Black" Geometry="F1 M 3.116,3.08267C 1.01867,5.156 0,7.70534 0,10.668L 0,10.668C 0,13.6307 1.01867,16.1187 3.116,18.1933L 3.116,18.1933C 5.21467,20.2653 7.79067,21.3333 10.7867,21.3333L 10.7867,21.3333C 13.784,21.3333 16.3,20.2653 18.3987,18.1933L 18.3987,18.1933C 19.536,17.1253 20.3147,15.94 20.8533,14.5787L 15.8213,12.6827C 15.5813,13.2733 15.1027,13.8667 14.6227,14.4013L 14.6227,14.4013C 13.544,15.4667 12.284,16 10.7867,16L 10.7867,16C 9.288,16 8.03067,15.4667 6.952,14.4013L 6.952,14.4013C 5.93333,13.3933 5.39333,12.148 5.39333,10.668L 5.39333,10.668C 5.39333,9.18534 5.93333,7.94134 6.952,6.87467L 6.952,6.87467C 8.03067,5.868 9.288,5.33333 10.7867,5.33333L 10.7867,5.33333C 12.224,5.33333 13.484,5.808 14.5027,6.756L 14.6227,6.87467L 12.5827,8.88933C 12.4027,9.00667 12.4027,9.12533 12.3427,9.244L 12.3427,9.244C 12.284,9.42267 12.284,9.48267 12.3427,9.54134L 12.3427,9.54134C 12.4027,9.65867 12.4627,9.71867 12.5827,9.71867L 20.6147,9.77867C 20.6747,9.77867 20.7947,9.71867 20.9133,9.71867L 20.9133,9.71867C 21.0333,9.6 21.0933,9.48267 21.2133,9.364L 21.2133,9.364C 21.2733,9.244 21.3333,9.12533 21.3333,9.06667L 21.2133,1.12667L 21.2133,1.06667C 21.2133,0.949335 21.1533,0.949335 21.0933,0.890669L 21.0933,0.890669C 21.0933,0.890669 21.0333,0.890669 21.0333,0.830669L 21.0333,0.830669C 20.9733,0.830669 20.9133,0.890669 20.7947,0.890669L 20.7947,0.890669C 20.6747,0.949335 20.4947,1.008 20.4347,1.12667L 18.3987,3.14L 18.336,2.964C 16.24,1.008 13.784,0.00133514 10.7867,0.00133514L 10.7867,0.00133514C 7.79067,0.00133514 5.21467,1.008 3.116,3.08267 Z " />
                </DrawingGroup.Children>
            </DrawingGroup>
        </DrawingImage.Drawing>
    </DrawingImage>

    <DrawingImage x:Key="SettingsImage">
        <DrawingImage.Drawing>
            <DrawingGroup>
                <DrawingGroup.Children>
                    <GeometryDrawing Brush="Black" Geometry="F1 M 15.6861,12.3139C 15.6861,14.3664 14.0355,16.0315 11.9987,16.0315C 9.96323,16.0315 8.31123,14.3664 8.31123,12.3139C 8.31123,10.2613 9.96323,8.59619 11.9987,8.59619C 14.0355,8.59619 15.6861,10.2613 15.6861,12.3139 Z M 22.0171,9.02298L 21.3552,9.02298C 21.1884,8.49114 20.9705,7.97768 20.717,7.48785L 21.1884,7.02167C 21.958,6.24426 22.2272,5.25542 21.7807,4.80762L 19.1924,2.21799C 18.7459,1.77282 17.7557,2.03546 16.977,2.81287L 16.5108,3.28168C 16.0223,3.02561 15.5089,2.81025 14.9757,2.64084L 14.9757,1.98162C 14.9757,0.887724 14.4622,1.90735e-006 13.8319,1.90735e-006L 10.1707,1.90735e-006C 9.53644,1.90735e-006 9.02692,0.887724 9.02692,1.98162L 9.02692,2.64084C 8.49114,2.81025 7.97899,3.02561 7.48654,3.28168L 7.01904,2.81287C 6.24688,2.03677 5.25542,1.77282 4.80893,2.21799L 2.22062,4.80762C 1.77282,5.25542 2.03808,6.24557 2.81287,7.02167L 3.27905,7.48523C 3.02429,7.97636 2.81287,8.49114 2.64347,9.02298L 1.98293,9.02298C 0.886408,9.02298 -3.69443e-007,9.53776 -3.69443e-007,10.1681L -3.69443e-007,13.828C -3.69443e-007,14.4622 0.886408,14.9744 1.98293,14.9744L 2.64347,14.9744C 2.81156,15.5089 3.02561,16.021 3.28037,16.5108L 2.81287,16.9783C 2.03808,17.7557 1.77282,18.7433 2.22062,19.1898L 4.80893,21.7794C 5.25542,22.2259 6.24688,21.9619 7.02035,21.1871L 7.48654,20.7183C 7.97899,20.9744 8.49114,21.1871 9.02692,21.3565L 9.02692,22.0158C 9.02692,23.111 9.53775,24 10.1707,24L 13.8319,24C 14.4662,24 14.9757,23.1136 14.9757,22.0158L 14.9757,21.3565C 15.5089,21.1884 16.0223,20.9744 16.5108,20.7183L 16.977,21.1871C 17.7557,21.9606 18.7459,22.2259 19.1924,21.7794L 21.7807,19.1898C 22.2272,18.7433 21.9606,17.7557 21.1884,16.977L 20.7223,16.5108C 20.977,16.021 21.1884,15.5089 21.3552,14.9744L 22.0171,14.9744C 23.1123,14.9744 24,14.4622 24,13.828L 24,10.1681C 24,9.53513 23.1123,9.02298 22.0171,9.02298 Z " />
                </DrawingGroup.Children>
            </DrawingGroup>
        </DrawingImage.Drawing>
    </DrawingImage>

    <DrawingImage x:Key="DownloadImage">
        <DrawingImage.Drawing>
            <DrawingGroup>
                <DrawingGroup.Children>
                    <GeometryDrawing Brush="Black" Geometry="F1 M 7.31715,1C 6.53554,1 5.90214,1.34422 5.90214,1.76847L 5.90214,9.04345L 4.41637,9.04345L 4.41279,9.04791C 4.1268,9.40453 4.1268,9.98303 4.41279,10.3398L 10.1483,17.4951C 10.4345,17.8519 10.8904,17.8156 11.1841,17.4951L 16.9199,10.3398C 17.2056,9.98303 17.2059,9.40453 16.9199,9.04758L 16.9162,9.04345L 15.4307,9.04345L 15.4307,1.76847C 15.4307,1.34422 14.797,1 14.0153,1L 7.31715,1 Z "/>
                    <GeometryDrawing Brush="Black" Geometry="F1 M 20.2149,15.032C 20.2149,17.4644 19.0435,19.4434 17.6039,19.4434L 3.72921,19.4434C 2.28969,19.4434 1.11828,17.4644 1.11828,15.032L 2.55142e-006,15.032C 2.55142e-006,18.5066 1.6729,21.3333 3.72921,21.3333L 17.6039,21.3333C 19.6603,21.3333 21.3333,18.5066 21.3333,15.032L 20.2149,15.032 Z "/>
                </DrawingGroup.Children>
            </DrawingGroup>
        </DrawingImage.Drawing>
    </DrawingImage>

    <Path 
        x:Key="StopPath"
        x:Shared="False"
        Stretch="None" 
        Width="10" 
        Height="10" 
        HorizontalAlignment="Center" 
        VerticalAlignment="Center" 
        Stroke="Black" 
        Fill="Black" 
        StrokeThickness="3" 
        Data="M 0,0 L 10,10 Z M 10,0 L 0,10 Z"/>

    <!-- TabView -->
    <Style TargetType="{x:Type local:TabView}">
        <Setter Property="Background" Value="#FFD2E6FA" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:TabView}">
                    <Border 
                        Background="{TemplateBinding Background}" 
                        BorderBrush="{TemplateBinding BorderBrush}" 
                        BorderThickness="{TemplateBinding BorderThickness}">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            <Grid MinHeight="30">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="30" />
                                    <ColumnDefinition Width="30" />
                                    <ColumnDefinition Width="30" />
                                    <ColumnDefinition Width="30" />
                                    <ColumnDefinition />
                                    <ColumnDefinition Width="30" />
                                    <ColumnDefinition Width="30" />
                                </Grid.ColumnDefinitions>
                                <Grid.Background>
                                    <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                        <GradientStop Color="#FFD2E6FA" Offset="0" />
                                        <GradientStop Color="#FF98B4D2" Offset="1" />
                                    </LinearGradientBrush>
                                </Grid.Background>
                                <Button 
                                    Margin="3" 
                                    Command="BrowseBack" 
                                    CommandTarget="{Binding ElementName=PART_Browser}" 
                                    Padding="0">
                                    <Path 
                                        Margin="0,0,2,0" 
                                        Stroke="Black" 
                                        Fill="Black" 
                                        Data="M 4,0 L 0,3.5 L 4,7 Z"/>
                                </Button>
                                <Button 
                                    Grid.Column="1" 
                                    Margin="3" 
                                    Command="BrowseForward" 
                                    CommandTarget="{Binding ElementName=PART_Browser}" 
                                    Padding="0">
                                    <Path 
                                        Margin="2,0,0,0" 
                                        Stroke="Black" 
                                        Fill="Black" 
                                        Data="M 0,0 L 4,3.5 L 0,7 Z"/>
                                </Button>
                                <Button 
                                    x:Name="RefreshButton"
                                    Grid.Column="2" 
                                    Margin="3" 
                                    Command="Refresh" 
                                    CommandTarget="{Binding ElementName=PART_Browser}" 
                                    Padding="0">
                                    <Image 
                                        Width="12" 
                                        Height="12" 
                                        HorizontalAlignment="Center" 
                                        VerticalAlignment="Center" 
                                        Stretch="Uniform" 
                                        Source="{StaticResource ReloadImage}"/>
                                </Button>
                                <Button 
                                    Grid.Column="3" 
                                    Margin="3" 
                                    Command="BrowseHome"
                                    CommandTarget="{Binding ElementName=PART_Browser}"
                                    Padding="0">
                                    <Image 
                                        Width="12" 
                                        Height="12" 
                                        Margin="0,0,0,2" 
                                        HorizontalAlignment="Center" 
                                        VerticalAlignment="Center" 
                                        Stretch="Uniform" 
                                        Source="{StaticResource HomeImage}"/>
                                </Button>
                                <Border 
                                    BorderBrush="White" 
                                    BorderThickness="0,0,0,0.55" 
                                    CornerRadius="5" 
                                    Grid.Column="4" 
                                    Margin="3">
                                    <Border 
                                        x:Name="AddressBorder" 
                                        Margin="0" 
                                        BorderBrush="Gray" 
                                        BorderThickness="1" 
                                        CornerRadius="5">
                                        <Border.Background>
                                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                <GradientStop Color="#FF98B4D2" Offset="0" />
                                                <GradientStop Color="#FFD2E6FA" Offset="1" />
                                            </LinearGradientBrush>
                                        </Border.Background>
                                        <TextBox 
                                            x:Name="PART_AddressBox" 
                                            BorderBrush="{x:Null}" 
                                            BorderThickness="0" 
                                            VerticalContentAlignment="Center" 
                                            Text="{Binding Source, ElementName=PART_Browser, UpdateSourceTrigger=Explicit}" 
                                            Background="Transparent"/>
                                    </Border>
                                </Border>

                                <Button 
                                    Grid.Column="5" 
                                    Margin="3" 
                                    Padding="0"
                                    Command="{x:Static local:MainWindow.ShowDownloads}">
                                    <Image 
                                        Width="12" 
                                        Height="12" 
                                        HorizontalAlignment="Center" 
                                        VerticalAlignment="Center" 
                                        Stretch="Uniform" 
                                        Source="{StaticResource DownloadImage}"/>
                                </Button>
                                <Button 
                                    Grid.Column="6" 
                                    Margin="3" 
                                    Padding="0"
                                    Command="{x:Static local:MainWindow.ShowSettings}">
                                    <Image 
                                        Width="12" 
                                        Height="12" 
                                        HorizontalAlignment="Center" 
                                        VerticalAlignment="Center" 
                                        Stretch="Uniform" 
                                        Source="{StaticResource SettingsImage}"/>
                                </Button>
                            </Grid>
                            <Border 
                                x:Name="browserContainer" 
                                Grid.Row="1" 
                                BorderThickness="0,1,0,0" 
                                BorderBrush="Gray" 
                                Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}">
                                <awe:WebControl x:Name="PART_Browser" />
                            </Border>
                            <Border 
                                Grid.Row="2" 
                                Height="25" 
                                Margin="3,0" 
                                BorderThickness="0,1,0,0" 
                                BorderBrush="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}">
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition />
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition Width="Auto" />
                                    </Grid.ColumnDefinitions>
                                    <TextBlock 
                                        VerticalAlignment="Center" 
                                        Text="{Binding TargetURL, ElementName=PART_Browser}" 
                                        TextTrimming="CharacterEllipsis"/>
                                    <ProgressBar 
                                        Grid.Column="1" 
                                        HorizontalAlignment="Right" 
                                        VerticalAlignment="Center" 
                                        Height="15" 
                                        MinWidth="120" 
                                        Margin="3,0" 
                                        Opacity="0.8" 
                                        IsIndeterminate="{Binding IsLoadingPage, ElementName=PART_Browser}" 
                                        Visibility="{Binding IsLoadingPage, ElementName=PART_Browser, Converter={StaticResource BooleanToVisibilityConverter}}"/>
                                    <TextBlock 
                                        Grid.Column="2" 
                                        VerticalAlignment="Center" 
                                        Margin="3,0" 
                                        Text="Zoom:"/>
                                    <Slider 
                                        Grid.Column="3" 
                                        DataContext="{Binding ElementName=PART_Browser}" 
                                        Minimum="10" 
                                        Maximum="400" 
                                        Width="120" 
                                        VerticalAlignment="Center" 
                                        Value="{Binding Zoom}" 
                                        AutoToolTipPlacement="TopLeft" 
                                        IsSnapToTickEnabled="True" 
                                        IsMoveToPointEnabled="True" 
                                        SmallChange="1" 
                                        LargeChange="10" 
                                        TickFrequency="10" 
                                        Focusable="False">
                                        <Slider.ContextMenu>
                                            <ContextMenu DataContext="{Binding PlacementTarget.DataContext, RelativeSource={RelativeSource Self}}">
                                                <MenuItem Command="{x:Static awe:WebControlCommands.ResetZoom}" CommandTarget="{Binding}" />
                                            </ContextMenu>
                                        </Slider.ContextMenu>
                                    </Slider>
                                </Grid>
                            </Border>
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger SourceName="PART_Browser" Property="IsNavigating" Value="True">
                            <Setter TargetName="RefreshButton" Property="Command" Value="BrowseStop" />
                            <Setter TargetName="RefreshButton" Property="Content" Value="{StaticResource StopPath}" />
                        </Trigger>
                        <Trigger SourceName="PART_AddressBox" Property="IsKeyboardFocused" Value="True">
                            <Setter TargetName="AddressBorder" Property="Background" Value="White" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type local:TabSourceView}" BasedOn="{StaticResource {x:Type local:TabView}}">
        <Setter Property="Background" Value="#FFD2E6FA" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:TabSourceView}">
                    <Border 
                        Background="{TemplateBinding Background}" 
                        BorderBrush="{TemplateBinding BorderBrush}" 
                        BorderThickness="{TemplateBinding BorderThickness}">
                        <awe:WebSourceControl x:Name="PART_Browser" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>